package 数据结构.排序.Text;


import 数据结构.排序.实例.$01_Comparable_Student_yws;

public class $01_Comparable_介绍 {
    public static void main(String[] args) {
        $01_Comparable_Student_yws s1 =new $01_Comparable_Student_yws();
        s1.setUsername("zhangsan");
        s1.setAge(23);
        $01_Comparable_Student_yws s2 =new $01_Comparable_Student_yws();
        s2.setUsername("lisi");
        s2.setAge(19);
        Comparable comparable=getMax(s1,s2);
        System.out.println(comparable);
    }
    public static Comparable getMax(Comparable c1,Comparable c2) {
        int result= c1.compareTo(c2);
        if(result>=0)
            return c1;
        else return c2;
    }
}
